<template>
    <div>
        <van-sticky>
            <van-search v-model="value" placeholder="请输入搜索关键词" />
        </van-sticky>
        <!-- 轮播图 -->
        <swipe :images="images"></swipe>
        <!-- 楼层 -->
        <div v-for="item in floor">
            <img :src="item.floor_title.image_src" alt="" width="100%">
            <div v-for="item in item.product_list">
                <img :src="item.image_src" alt="" class="img">
            </div>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue';
import axios from '../../request'
import swipe from '../../components/swipe.vue'
const value = ref('');
//轮播图
const images = ref([])
const imagesinit = () => {
    axios.get("https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata").then((res) => {
        images.value = res
        console.log('轮播', res)
    })
}
imagesinit()
//楼层
const floor = ref([])
const floorinit = () => {
    axios.get("https://api-hmugo-web.itheima.net/api/public/v1/home/floordata").then((res) => {
        floor.value = res
        console.log('轮播', res)
    })
}
floorinit()
</script>

<style lang="scss" scoped>
.img {
    float: left;
    width: 120px;
    height: 120px;
    margin-left: 3px;
}
</style>